﻿using Geolocation;

namespace Bigway.Common.Models;

public class Coordinate(double latitude, double longitude, double altitude = 0)
{
    public double Latitude { get; } = latitude;
    public double Longitude { get; } = longitude;
    public double Altitude { get; } = altitude;

    public double GetDistance(Coordinate destination)
    {
        return GeoCalculator.GetDistance(
            Latitude, Longitude,
            destination.Latitude, destination.Longitude,
            distanceUnit: DistanceUnit.Kilometers
        );
    }

    public double GetDistance(double latitude, double longitude)
    {
        return GeoCalculator.GetDistance(
            Latitude, Longitude,
            latitude, longitude,
            distanceUnit: DistanceUnit.Kilometers
        );
    }
}